<style>
    .box {
        width: 200px;
        height: 200px;
        /* 逗号隔开多个值, 从透明到半透明 渐变 */
        background-image: linear-gradient(transparent, rgba(0, 0, 0, .5));
    }
</style>

<div class="box"></div>